<template>
	<view >
		<view class="line-goods" v-if="showGoodsList.length > 0" v-for="(lineItem,index) in showGoodsList":key="index">
			<view class="line-left">
				<yh-goods-item :goodsItem="lineItem[0]" />
			</view>
			<view class="line-right" v-if="lineItem.length == 2">
				<yh-goods-item :goodsItem="lineItem[1]" />
			</view>
		</view>
	</view>
</template>
<script>
  import { oneConvertTwoArray } from '@/utils/index'
  export default
  {
    // 组件名称
    name: 'yh-goods-list',
    // 组件
    components:
    {
    },
	//属性
    props:
    {
		goodsList:{
			type:Array,
			default:function()
			{
				return []
			}
		}
    },
    // 数据
    data()
    {
        return {
          msg: '产品列表组件'
        }
    },
    // 计算属性
    computed:
    {
		showGoodsList()
		{
			let showGoodsList = []
			
			showGoodsList = oneConvertTwoArray(this.goodsList)
			
			return showGoodsList
		}
    },
    // 监听
    watch:
    {

    },
    // 实例创建之前
    beforeCreate()
    {

    },
    // 创建
    created()
    {

    },
    // 挂载之前
    beforeMount()
    {

    },
    // 挂载 
    mounted()
    {

    },
    // 更新之前
    beforeUpdate()
    {

    },
    // 跟新后
    updated()
    {

    },
    // 销毁之前
    beforeDestroy()
    {

    },
    // 销毁后
    destroyed()
    {

    },
    // 方法
    methods:
    {

    }
  }
</script>
<style lang='scss' scoped>
	.line-goods{
		display: flex;
		flex-direction: row;
		justify-content:flex-start;
		margin-top: 32rpx;
		.line-left{
			margin-left: 28rpx;
		}
		.line-right{
			margin-left: 22rpx;
		}
	}
</style>
